Class symantec.itools.awt.util.ColorUtils
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class symantec.itools.awt.util.ColorUtils

Object
   |
   +----symantec.itools.awt.util.ColorUtils

public class ColorUtils
extends Object
Many useful color related utility functions for color manipulation.

Version:
1.1, August 5, 1997
Author:
Symantec

Constructor Index

 o symantec.itools.awt.util.ColorUtils()
Do not use, this is an all-static class.

Method Index

 o calculateHilightColor(Color)
Used to calculate a hilight color from a given color.
 o calculateShadowColor(Color)
Used to calculate a shadow color from a given color.
 o darken(int, int, int, double)
Darkens a given color by the specified percentage.
 o darken(Color, double)
Darkens a given color by the specified percentage.
 o fade(Color, Color, double)
Fades from one color to another by the given percentage.
 o lighten(int, int, int, double)
Lightens a given color by the specified percentage.
 o lighten(Color, double)
Lightens a given color by the specified percentage.
 o lightness(Color)
Given a Color this function determines the lightness percent.

Constructors

 o ColorUtils
public ColorUtils()
Do not use, this is an all-static class.

Methods

 o calculateHilightColor
public static java.awt.Color calculateHilightColor(Color c)
Used to calculate a hilight color from a given color.

Parameters:
c - The color to use in the calculation. If null, then it will return null.
Returns:
the newly calculated hilight color.
 o calculateShadowColor
public static java.awt.Color calculateShadowColor(Color c)
Used to calculate a shadow color from a given color.

Parameters:
c - The color to use in the calculation If null, then it will return null.
Returns:
the newly calculated shadow color.
 o darken
public static java.awt.Color darken(int r,
                                    int g,
                                    int b,
                                    double percent) throws IllegalArgumentException
Darkens a given color by the specified percentage.

Parameters:
r - The red component of the color to darken.
g - The green component of the color to darken.
b - The blue component of the color to darken.
percent - percentage to darken. Needs to be <= 1 && >= 0.
Returns:
a new Color with the desired characteristics.
Throws: IllegalArgumentException
if the specified percentage value is unacceptable
 o darken
public static java.awt.Color darken(Color c,
                                    double percent) throws IllegalArgumentException
Darkens a given color by the specified percentage.

Parameters:
to - the Color to darken.
percent - percentage to darken. Needs to be <= 1 && >= 0.
Returns:
a new Color with the desired characteristics.
Throws: IllegalArgumentException
if the specified percentage value is unacceptable
 o fade
public static java.awt.Color fade(Color from,
                                  Color to,
                                  double percent) throws IllegalArgumentException
Fades from one color to another by the given percentage.

Parameters:
from - the Color to fade from.
to - the Color to fade to.
percent - percentage to fade. Needs to be <= 1 && >= 0.
Returns:
a new Color with the desired characteristics.
Throws: IllegalArgumentException
if the specified percentage value is unacceptable
 o lighten
public static java.awt.Color lighten(int r,
                                     int g,
                                     int b,
                                     double percent) throws IllegalArgumentException
Lightens a given color by the specified percentage.

Parameters:
r - The red component of the color to lighten.
g - The green component of the color to lighten.
b - The blue component of the color to lighten.
percent - percentage to lighten. Needs to be <= 1 && >= 0.
Returns:
a new Color with the desired characteristics.
Throws: IllegalArgumentException
if the specified percentage value is unacceptable
 o lighten
public static java.awt.Color lighten(Color c,
                                     double percent) throws IllegalArgumentException
Lightens a given color by the specified percentage.

Parameters:
to - the Color to lighten.
percent - percentage to lighten. Needs to be <= 1 && >= 0.
Returns:
a new Color with the desired characteristics.
Throws: IllegalArgumentException
if the specified percentage value is unacceptable
 o lightness
public static double lightness(Color c)
Given a Color this function determines the lightness percent.

Parameters:
c - The Color to calculate from. If null, it will return 0.
Returns:
the percent light of the specified color. This value will be >= 0 && <= 1.

All Packages  Class Hierarchy  This Package  Previous  Next  Index